﻿//TODO: BEGIN SJC
//DATA: 03/06/2012
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Kcadastro.classes;

namespace Kcadastro.os
{
    public partial class osTermo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //TODO: BEGIN Seleciona Link Serviços
            if (this.Master is kcadastro)
            {
                ((kcadastro)this.Page.Master).SelecionaPagina(FW.utils.enumPaginas.Termos);
            }
            //TODO:END
            if (!Page.IsPostBack)
                chkAceito.Checked = seguranca.leuTermo();
        }

        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["IDuser"] != null)
            {
                if (HttpContext.Current.Session["IDuser"].ToString() != "")
                {
                    int _iduser = Convert.ToInt16(HttpContext.Current.Session["IDuser"].ToString());
                    usuarios user = new usuarios();
                    user.confirmarLeitura(_iduser, chkAceito.Checked);
                    user = null;
                }
            }

            if (Session["VoltarOS"] != null)
                if ((bool)Session["VoltarOS"] == true)
                {
                    Session.Remove("VoltarOS");
                    if (chkAceito.Checked)
                        Response.Redirect("osEdit.aspx", true);
                }

            Response.Redirect("/inicio.aspx", true);
        }

        protected void btnCancelar_Click(object sender, EventArgs e)
        {
            Response.Redirect("/inicio.aspx", true);
        }
    }
}
//END